using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

using PACKETPARSERMAX20.CORE;

namespace PACKETPARSERMAX20.WinUI
{
    public partial class frmStatus : DockContent
    {
        public frmStatus()
        {
            InitializeComponent();
        }

 
        public void UpdateStatusLog(string time, string message, bool attention)
        {
            if (InvokeRequired)
            {
                 EventManager.DelegateUpdateStatusLog tDelegate = new EventManager.DelegateUpdateStatusLog(UpdateStatusLog);
                this.Invoke(tDelegate, new object[] { time, message, attention });
            }
            else
            {
                if (lstStatus.Items.Count == 50) { lstStatus.Items.Clear(); }
                ListViewItem tListViewItem = lstStatus.Items.Add(time);
                tListViewItem.SubItems.Add(message);
                if (attention)
                {
                    Font tFont = new Font(tListViewItem.Font, FontStyle.Bold);
                    tListViewItem.ForeColor = Color.Yellow;
                    tListViewItem.BackColor = Color.Black;
                    tListViewItem.Font = tFont;
                }
                tListViewItem.EnsureVisible();
            }
        }

        private void lstStatus_DoubleClick(object sender, EventArgs e)
        {
            lstStatus.Items.Clear();
        }
    }
}